package org.easy.mongo;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;

/**
 * @author: Li chaojie
 * @Date: 2022/10/26
 * @Description:
 */
@Configuration
@Slf4j
@EnableConfigurationProperties
@EnableMongoRepositories
public class MongoAutoConfiguration {


    @Bean
    @ConditionalOnMissingBean(name = "mongoUtil")
    public MongoUtil mongoUtil(MongoTemplate redisTemplate) {
        return new MongoUtil(redisTemplate);
    }


}
